package com.sh.controller;

import com.sh.common.BaseResult;
import com.sh.service.user.IUserResourceService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 资源目录（无需校验权限）
 * */
@Slf4j
@RestController
@RequestMapping("/user/resource/tree")
public class UserResourceTreeController {
    @Autowired
    private IUserResourceService userResourceService;

    @GetMapping("/bucket/list")
    public BaseResult listBucket() {
        return BaseResult.success(userResourceService.listUserBuckets());
    }


    /**
     * 查询桶初始路径
     */
    @GetMapping("/path/list")
    public BaseResult listFirstFolder(@RequestParam(name = "bucket") String bucket) {
        return BaseResult.success(userResourceService.listUserFirstFolders(bucket));
    }

}
